Scope webhooks per github-app with optional signature validation - #58
Merged
Conversation
Webhook handling was a single global endpoint with a top-level
webhook-target. This reworks it to be per github-app so different apps
can be bridged (or not) independently, and adds optional validation of
GitHub webhook deliveries.
- Callback URL now encodes the app: POST /webhook/{github-app}. The
handler resolves the named app (404 if unknown) before doing anything.
- Move webhook-target from the top-level config into the [[github-app]]
block. The [nats] connection stays top-level and is shared by every
app that opts in; idcat connects to NATS when any app sets
webhook-target = "nats".
- Add optional webhook-validation-secret-file to [[github-app]]. When
set, idcat verifies the X-Hub-Signature-256 header (HMAC-SHA256 over
the raw body, constant-time compare) per GitHub's documented scheme
and rejects mismatches with 401. The secret is read per delivery so it
can be rotated without a restart.
Adds hmac and hex dependencies (matching the existing sha2 0.10).
nresare
force-pushed
the
webhook-per-app-validation
branch
from
July 16, 2026 12:16
fbde66d to
4034eab
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Reworks GitHub webhook handling from a single global endpoint into a per-github-app feature, and adds optional validation of incoming webhook deliveries.
POST /webhook/{github-app}(e.g./webhook/deployments), consistent with the existing/installation-token/{github-app}/...and/proxy/{github-app}/...routes. The handler resolves the named app first and returns 404 for an unknown one.webhook-targetmoved into[[github-app]]: each app opts into bridging independently. The[nats]connection block stays top-level and is shared; idcat connects to NATS when any app setswebhook-target = "nats".webhook-validation-secret-fileon[[github-app]]: when set, idcat verifies theX-Hub-Signature-256header (HMAC-SHA256 over the raw body, constant-time compare) following GitHub's documented scheme and rejects mismatches (and missing signatures) with 401. The secret is read from the file per delivery, so it can be rotated without restarting idcat.Why
Previously all webhooks hit one
/webhookendpoint with a single globalwebhook-target, so there was no way to bridge some apps but not others, and no way to authenticate that a delivery genuinely came from GitHub. Encoding the app in the URL lets idcat select the right config — including the right validation secret — per delivery.Notes for reviewers
hmacandhexdependencies (pinned to versions matching the existingsha2 = "0.10").webhook-target.cargo fmt --check,cargo clippy --all-targets, andcargo testall pass.README.mdandidcat.toml.exampledocument the new URL scheme and options.